package core.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public final class TimeZoneUtil {
	private static Logger logger = LoggerFactory.getLogger(TimeZoneUtil.class); 
	
	public static String asChinaTime(String usaTime) {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		long time = 13 * 3600 * 1000; // convert the timezone from USA to China
		try {
			time += sdf.parse(usaTime).getTime();
		} catch (ParseException e) {
			logger.error(e.getMessage(), e);
		}
		return sdf.format(new Date(time));
	}

}
